﻿<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <title>领奖信息</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="keywords" content="{{ env('APP_KEYWORDS', '') }}">
    <meta name="description" content="{{ env('APP_DESCRIPTION', '') }}">
    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <!-- Styles -->
    <link href="{{ asset('js/layui/css/layui.css') }}" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{{ asset('js/jquery-1.11.2.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/layer/layer.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/layui/layui.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/main.js') }}"></script>
    <link rel="shortcut icon" href="favicon.ico" />
    <base target="_self">
    <style>
        .input-tips {
            color: red;
            line-height: 32px;
        }
    </style>
</head>

<body>

<form class="layui-form" action="" style="width: 100%; margin-top: 20px;">
    <input type="hidden" name="id" value="{{ $id }}">
    <div class="layui-form-item">
        <label class="layui-form-label">中奖金额:</label>
        <div class="layui-input-inline" style="width: 295px">
            <input type="text" required value="{{$log->money}}" autocomplete="off" class="layui-input" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">游戏账号</label>
        <div class="layui-input-inline" style="width: 295px">
            <input type="text" name="game_num" required  lay-verify="required" placeholder="请输入游戏账号" autocomplete="off" class="layui-input">
        </div>
        <span class="input-tips">(游戏内请注册此账号)</span>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认账号</label>
        <div class="layui-input-inline" style="width: 295px">
            <input type="text" name="re_game_num" required  lay-verify="required" placeholder="请确认游戏账号" autocomplete="off" class="layui-input">
        </div>
        <span class="input-tips">(确认账号)</span>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">游戏名称</label>
        <div class="layui-input-inline" style="width: 295px">
            <select name="game_id" lay-verify="required" lay-filter="changeGame" id="game-select">
                <option value="">请选择游戏名称</option>
                @foreach($games as $gi => $game)
                    <option
                        value="{{$game->id}}"
                        data-id="{{$game->id}}"
                        @if ($log->money <= 20 && $gi > 6) disabled @endif
                    >{{$game->server_name}}</option>
                @endforeach
            </select>
        </div>
        <span class="input-tips">(请填写网站内游戏名字)</span>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">游戏区服</label>
        <div class="layui-input-inline" style="width: 14%;">
            <select name="date" lay-verify="required" class="layui-input-inline" lay-filter="changeGame" id="date-select">
                <option value="今日" data-val="t">今日</option>
                <option value="昨日" data-val="y">昨日</option>
            </select>
        </div>
        <div class="layui-input-inline">
            <select name="game_server" lay-verify="required" id="server-val" class="layui-input-inline"></select>
        </div>

        <span class="input-tips">(请填写已经开区的区服。例：二区、三区)</span>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">确定</button>
        </div>
    </div>

    <label class="layui-form-label" style="width: 90%;text-align: left;margin:0;padding: 0 15px;"><span class="input-tips">提示：再次点击转盘可查询领奖到账情况，长时间没到账的玩家请联系客服</span></label>
    <label class="layui-form-label" style="width: 90%;text-align: left;margin:0;padding: 0 15px;"><span class="input-tips">敬告：同一账号多次领取的玩家，判定为刷号，不予发放奖励，请知晓</span></label>
    <img src="/images/01902.PNG" alt="">
</form>

<script>


    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            sendRequest('POST', '{{route("commitDrawNum", "")}}',data.field, function (response) {
                layer.open({
                    content: response.message,
                    yes: function(index, layero){
                        //do something
                        layer.closeAll();
                        parent.layer.closeAll(); //如果设定了yes回调，需进行手工关闭
                    }
                });
            })
            return false;
        });

        form.on('select(changeGame)', function(data){
            let id = $("#game-select option:selected").attr("data-id")
            let day = $("#date-select option:selected").attr("data-val")
            getServerList(day, id)
        });
    });

    function getServerList(day, id) {
        if (!day || !id) {
            return
        }
        sendRequest('GET', '{{route("getGameServer", '')}}/' + id + '?day=' + day, {}, function (res) {
            $('#server-val').empty()
            $.each(res.data, function (index, object) {
                let dis = object.is_disable ? '' : 'disabled';
                let checked = object.is_checked ? ' selected="selected""' : '';
                $('#server-val').append(`<option value="${object.server_name}" ${dis} ${checked}>${object.server_name}(${object.open_server_time.substr(0,5)})</option>`);
            });
            layui.use('form', function(){
                let form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
                form.render('select');
            });
        })
    }

</script>

</body>


</html>
